import { createApp } from "vue";
import App from "./App.vue";
import router from "./router";  //导入router
// import axios from "axios";  //导入axios
import axios from "./api/http";
import ElementPlus from 'element-plus';  //导入element ui
import 'element-plus/dist/index.css';  //导入element css
import * as ElementPlusIconsVue from '@element-plus/icons-vue'; // 统一导入el-icon图标
import locale from 'element-plus/es/locale/lang/zh-cn'; //导入中文包
import directives from "@/directives"; //导入自定义指令
//代码高亮
import 'highlight.js/styles/atom-one-dark.css' // 样式
import 'highlight.js/lib/common' // 依赖包
import hljsVuePlugin from '@highlightjs/vue-plugin' // 支持vue3的组件

const app = createApp(App);  //创建实例

// 统一注册el-icon图标
for (const iconName in ElementPlusIconsVue) {
  app.component(iconName, ElementPlusIconsVue[iconName])
}

app.use(ElementPlus, { locale }); //注册中文
app.config.globalProperties.$http = axios; //注册axios
app.use(router);  //注册router
app.use(ElementPlus); //注册ElementPlus
app.use(directives)  //注册自定义指令
app.use(hljsVuePlugin) // 引入代码高亮，并进行全局注册

app.mount("#app"); //挂载实例
// createApp(App).use(router).mount("#app");
